<template>
  <div class="layout">
    <div class="title">朋友圈Top10</div>
    <div class="btnList">
      <el-radio-group v-model="currentIndex">
        <el-radio-button label="1">点赞数</el-radio-button>
        <el-radio-button label="2">评论数</el-radio-button>
        <el-radio-button label="3">评论人数</el-radio-button>
      </el-radio-group>
      <!-- <div class="right_btn" @click="educe">导出</div> -->
    </div>
    <div class="dataList" v-if="topData.length > 0">
      <ul class="list">
        <li class="list_item" v-for="(item, index) in topData" :key="index">
          <div class="left">
            <span class="item_id">{{ index + 1 }}</span>
            <span class="item_title">{{ item.title }}</span>
          </div>
          <div class="right">
            <div class="icon">
              <img src="@/assets/login/visible.png" alt="" />
            </div>
            <div class="number">{{ item.num }}</div>
          </div>
        </li>
      </ul>
    </div>
    <div class="no_data" v-else>
      <img class="no_img" src="@/assets/noData.png" alt="" />
      <div class="emty_title">暂无数据</div>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { reactive, ref, watch } from 'vue'
  const currentIndex = ref(1)
  const props = defineProps(['topData'])
  const emit = defineEmits({
    changeIndex: null
  })

  watch(currentIndex, (v) => {
    currentIndex.value = v
    emit('changeIndex', v)
  })
</script>

<style lang="scss" scoped>
  ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  .layout {
    height: 630px;
    padding: 16px;
    background: #fff;
    margin-top: 16px;
    border: 1px solid #eaeaea;
    .title {
      font-size: 16px;
      padding-bottom: 17px;
      border-bottom: 1px solid #eaeaea;
    }
    .btnList {
      display: flex;
      justify-content: space-between;
      margin-top: 20px;
      .left_btn {
        display: flex;
        .btn_item {
          color: #ff6b00;
          font-size: 16px;
          padding: 10px 18px;
          border: 1px solid #ff6b00;
          background: #fff;
          cursor: pointer;
        }
        .active {
          background: #ff6b00;
          color: #fff;
        }
      }
      .right_btn {
        font-size: 14px;
        border: 1px solid #eaeaea;
        height: 36px;
        line-height: 36px;
        padding: 0 18px;
        cursor: pointer;
      }
    }
    .dataList {
      margin-top: 20px;
      font-size: 14px;
      color: #33302d;
      .list {
        &_item {
          display: flex;
          justify-content: space-between;
          align-items: center;
          border-bottom: 1px dashed #eaeaea;
          padding: 17px 17px 17px 20px;
          &:nth-child(2n) {
            background-color: #f9f9f9;
          }
          .left {
            .item_id {
              margin: 0 14px 0 0;
              color: #ff6b00;
            }
          }
          .right {
            display: flex;
            align-items: center;
            .icon {
              width: 14px;
              height: 10px;
              margin-top: -5px;
              img {
                width: 100%;
                height: 100%;
              }
            }
            .number {
              color: #969696;
              font-size: 14px;
              margin-left: 2px;
            }
          }
        }
      }
    }

    .no_data {
      height: 500px;
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      .no_img {
        margin-left: 35px;
      }
      .emty_title {
        color: #909399;
        margin: 0;
      }
    }
  }
</style>
